PLPLOT Subroutine Reference

All the PLPLOT subroutines are listed below in alphabetical order.

pladv(sub);

Advances to the next subpage if sub=0 or to the specified subpage if sub is non-zero. This routine is called automatically (with sub=0) by plenv, but if plenv is not used, pladv must be called after plstar but before defining the viewport.

sub (int, input)Specifies the subpage number (starting from 1 in the top left corner and increasing along the rows) to which to advance. Set to zero to advance to the next subpage.

plbeg(dev,nx,ny);

Alternative to plstar for initializing the plotting package. The device number of the desired output device must be supplied as an argument. The mapping from device numbers to devices varies from one implementation to another, and so use of plstar which prompts for the device type is recommended. The device codes are the same as those printed out by plstar. This routine also divides the output device into nx by ny sub-pages, each of which may be used independently. The subroutine pladv is used to advance from one subpage to the next.

dev (int, input)Device number of the required output device.

nx (int, input)Number of subpages to divide output page in the horizontal direction.

ny (int, input)Number of subpages to divide output page in the vertical direction.

plbin(nbin,x,y,cen);

Plots a histogram consisting of n bins. The value associated with the i'th bin is placed in x[i], and the number of points in the bin is placed in y[i]. For proper operation, the values in x[i] must form a strictly increasing sequence. If centre is false, x[i] is the left-hand edge of the i'th bin, and if centre is true, the bin boundaries are placed midway between the values in the x array. Also see plhist for drawing histograms from unbinned data.

nbin (int, input)Number of bins (i.e., number of values in x and y arrays.)

x (float *, input)Pointer to array containing values associated with bins. These must form a strictly increasing sequence.

y (float *, input)Pointer to array containing number of points in bin. This is a float array so as to allow histograms of probabilities, etc.

cen (int, input)Indicates whether the values in x represent the lower bin boundaries (cen=0) or whether the bin boundaries are to be midway between the x values (cen=1). If the values in x are equally spaced and cen=1, the values in x are the centre values of the bins.

plbox(xopt,xtick,nxsub,yopt,ytick,nysub);

Draws a box around the currently defined viewport, and labels it with world coordinate values appropriate to the window. Thus plbox should only be called after defining both viewport and window. The character strings xopt and yopt specify how the box should be drawn as described below. If ticks and/or subticks are to be drawn for a particular axis, the tick intervals and number of subintervals may be specified explicitly, or they may be defaulted by setting the appropriate arguments to zero.

xopt (char *, input)Pointer to character string specifying options for horizontal axis. The string can include any combination of the following letters (upper or lower case) in any order:

xtick (float, input)World coordinate interval between major ticks on the x axis. If it is set to zero, PLPLOT automatically generates a suitable tick interval

nxsub (int, input)Number of subintervals between major x axis ticks for minor ticks. If it is set to zero, PLPLOT automatically generates a suitable minor tick interval.

yopt (char *, input)Pointer to character string specifying options for vertical axis. The string can include any combination of the letters defined above for xopt, and in addition may contain:

ytick (real, input)World coordinate interval between major ticks on the y axis. If it is set to zero, PLPLOT automatically generates a suitable tick interval

nysub (int, input)Number of subintervals between major y axis ticks for minor ticks. If it is set to zero, PLPLOT automatically generates a suitable minor tick interval.

plbox3(  xopt,xlabel,xtick,nxsub,yopt,ylabel,ytick,nysub,
   zopt,zlabel,ztick,nzsub);

Draws axes, numeric and text labels for a three-dimensional surface plot. See Section [*] on page [*] for a more complete description of three-dimensional plotting.

xopt (char *, input)Pointer to character string specifying options for the x axis. The string can include any combination of the following letters (upper or lower case) in any order:

xlabel (char *, input)Pointer to character string specifying text label for the x axis. It is only drawn if u is in the xopt string.

xtick (float, input)World coordinate interval between major ticks on the x axis. If it is set to zero, PLPLOT automatically generates a suitable tick interval

nxsub (int, input)Number of subintervals between major x axis ticks for minor ticks. If it is set to zero, PLPLOT automatically generates a suitable minor tick interval.

yopt (char *, input)Pointer to character string specifying options for the y axis. The string is interpreted in the same way as xopt.

ylabel (char *, input)Pointer to character string specifying text label for the y axis. It is only drawn if u is in the yopt string.

ytick (float, input)World coordinate interval between major ticks on the y axis. If it is set to zero, PLPLOT automatically generates a suitable tick interval

nysub (int, input)Number of subintervals between major y axis ticks for minor ticks. If it is set to zero, PLPLOT automatically generates a suitable minor tick interval.

zopt (char *, input)Pointer to character string specifying options for the z axis. The string can include any combination of the following letters (upper or lower case) in any order:

zlabel (char *, input)Pointer to character string specifying text label for the z axis. It is only drawn if u or v are in the zopt string.

ztick (float, input)World coordinate interval between major ticks on the z axis. If it is set to zero, PLPLOT automatically generates a suitable tick interval

nzsub (int, input)Number of subintervals between major z axis ticks for minor ticks. If it is set to zero, PLPLOT automatically generates a suitable minor tick interval.

plclr

Clears the graphics screen of an interactive device, or ejects a page on a plotter.

plcol(colour);

Sets the colour for subsequent lines.

colour (int, input)Integer representing the colour.

plcont(z,nx,ny,kx,lx,ky,ly,clevel,nlevel,tr);

Draws a contour plot of the data in z[nx][ny], using the nlevel contour levels specified by clevel. Only the region of the array from kx to lx and from ky to ly is plotted out. A transformation routine tr is used to map indicies within the array to the world coordinates (see Section [*] on page [*]).

z (float *, input) Pointer to a two-dimensional array containing data to be contoured.

nx, ny (int, input) Physical dimensions of array z.

kx, lx (int, input) Range of x indicies to consider.

ky, ly (int, input) Range of y indicies to consider.

clevel (float *, input) Pointer to array specifying levels at which to draw contours

nlevel (int, input) Number of contour levels to draw

tr (void *,input) Pointer to function that defines transformation between indicies in array z and the world coordinates. The function should have the form tr(x,y,tx,ty); x, y (float, input) Specifies the position in the array through which the contour runs in terms of the array indicies tx, ty (float *, output)Pointers to the world coordinates corresponding to the point (x,y) A transformation function xform is provided for simple linear mappings. See Section [*] for information.

plend();

Ends a plotting session, tidies up all the output files, switches interactive devices back into text mode and frees up any memory that was allocated. Must be called before end of program.

plenv(xmin,xmax,ymin,ymax,just,axis);

Sets up plotter environment for simple graphs by calling pladv and setting up viewport and window to sensible default values. plenv leaves enough room around most graphs for axis labels and a title. When these defaults are not suitable, use the individual routines plvspa or PLVPOR for setting up the viewport, plwind for defining the window, and PLBOX for drawing the box.

xmin (float, input)Value of x at left-hand edge of window.

xmax (float, input)Value of x at right-hand edge of window.

ymin (float, input)Value of y at bottom edge of window.

ymax (float, input)Value of y at top edge of window.

just (int, input)If just=0, the x and y axes are scaled independently to use as much of the screen as possible, but if just=1, the scales of the x and y axes are made equal.

axis (int, input)Controls drawing of the box around the plot:

plerrx(n,xmin,xmax,y)

Draws a set of n horizontal error bars, the i'th error bar extending from xmin[i] to xmax[i] at y coordinate y[i]. The terminals of the error bar are of length equal to the minor tick length (settable using plsmin).

n (int, input)Number of error bars to draw.

xmin (float *, input)Pointer to array with x coordinates of left-hand endpoint of error bars.

xmax (float *, input)Pointer to array with x coordinates of right-hand endpoint of error bars.

y (float *, input)Pointer to array with y coordinates of error bar.

plerry(n,x,ymin,ymax);

Draws a set of n vertical error bars, the i'th error bar extending from ymin[i] to ymax[i] at x coordinate x[i]. The terminals of the error bar are of length equal to the minor tick length (settable using plsmin).

n (int, input)Number of error bars to draw.

x (float *, input)Pointer to array with x coordinates of error bars.

ymin (float *, input)Pointer to array with y coordinates of lower endpoint of error bars.

ymax (float *, input)Pointer to array with y coordinate of upper endpoint of error bar.

plfont(font);

Sets the default character font for subsequent character drawing. Also affects symbols produced by plpoin.

font (int, input)Specifies the font:

plgra();

Sets an interactive device to graphics mode, used in conjunction with pltext to allow graphics and text to be interspersed.

plgrid3(ztick);

Draws grid lines perpendicular to the z axis. For use only when doing three dimensional plots. If used this routine must be called after calling plot3d first (in order for the hidden line removal to work).

ztick (float, input)World coordinate interval between grid lines on the z axis. Usually this variable has the same value as ztick in plbox3. If ztick is zero PLPLOT will automatically generate a suitable tick interval.

plgspa(xmin,xmax,ymin,ymax);

Gets the size of the current subpage in millimetres measured from the bottom left hand corner of the output device page or screen. Can be used in conjunction with plsvpa for setting the size of a viewport in absolute coordinates (millimetres).

xmin (float *, output)Pointer to variable with position of left hand edge of subpage in millimetres

xmax (float *, output)Pointer to variable with position of right hand edge of subpage in millimetres

ymin (float *, output)Pointer to variable with position of bottom edge of subpage in millimetres

ymax (float *, output)Pointer to variable with position of top edge of subpage in millimetres

plhist(n,data,datmin,datmax,nbin,oldwin);

Plots a histogram from n data points stored in the array data. This routine bins the data into nbin bins equally spaced between datmin and datmax, and calls plbin to draw the resulting histogram. Parameter oldwin allows the histogram either to be plotted in an existing window or causes plhist to call plenv with suitable limits before plotting the histogram.

n (int, input)Number of data points

data (float *, input)Pointer to array with values of the n data points.

datmin (float, input)Left-hand edge of lowest-valued bin.

datmax (float, input)Right-hand edge of highest-valued bin.

nbin (int, input)Number of (equal-sized) bins into which to divide the interval xmin to xmax

oldwin (int, input)If one, the histogram is plotted in the currently-defined window, and if zero, plenv is called automatically before plotting.

pljoin(x1,y1,x2,y2);

Joins the point (x1,y1) to (x2,y2).

x1 (float, input)x coordinate of first point.

y1 (float, input)y coordinate of first point.

x2 (float, input)x coordinate of second point.

y2 (float, input)y coordinate of second point.

pllab(xlabel,ylabel,tlabel);

Routine for writing simple labels. Use plmtex for more complex labels.

xlabel (char *, input)Label for horizontal axis.

ylabel (char *, input)Label for vertical axis.

tlabel (char *, input)Title of graph.

plline(n,x,y);

Draws n-1 line segments joining points (x[i],y[i]).

n (int, input)Number of points to join.

x (float *, input)Pointer to array with x coordinates of points.

y (float *, input)Pointer to array with y coordinates of points.

plmtex(side,disp,pos,just,text);

Writes text at a specified position relative to the viewport boundaries. Text may be written inside or outside the viewport, but is clipped at the subpage boundaries. The reference point of a string lies along a line passing through the string at half the height of a capital letter. The position of the reference point along this line is determined by just, and the position of the reference point relative to the viewport is set by disp and pos.

side (char *, input)Specifies the side of the viewport along which the text is to be written. The string must be one of:

disp (float, input)Position of the reference point of string, measured outwards from the specified viewport edge in units of the current character height. Use negative disp to write within the viewport.

pos (float, input)Position of the reference point of string along the specified edge, expressed as a fraction of the length of the edge.

just (float, input)Specifies the position of the string relative to its reference point. If just=0, the reference point is at the left and if just=1, it is at the right of the string. Other values of just give intermediate justifications.

text (char *, input)The string to be written out.

plot3d(x,y,z,work,ly,nx,ny,opt);

Plots a three dimensional surface plot within the environment set up by plw3d. The surface is defined by the two-dimensional array z[][ly], the point z[i][j] being the value of the function at (x[i],y[j]). Note that the points in arrays x and y do not need to be equally spaced, but must be stored in ascending order. The parameter opt controls the way in which the surface is displayed. See Section [*] on page [*] for further details.

x (float *, input)Pointer to set of x coordinate values at which the function is evaluated.

y (float *, input)Pointer to set of y coordinate values at which the function is evaluated.

z (float *, input)Pointer to two dimensional array with set of function values.

work (int *, input and output)Pointer to work array of dimension at least four times the maximum of nx and ny.

ly (int, input)Declared second dimension of z array.

nx (int, input)Number of x values at which function is evaluated.

ny (int, input)Number of y values at which function is evaluated.

opt (int, input)Determines the way in which the surface is represented:

plpoin(n,x,y,code);

Marks out a set of n points at positions (x(i),y(i)), using the symbol defined by code. If code is between 32 and 127, the symbol is simply the printable ASCII character in the default font.

n (int, input)Number of points to be marked.

x (float *, input)Pointer to array with set of x coordinate values for the points.

y (float *, input)Pointer to array with set of y coordinate values for the points.

code (int, input)Code number for the symbol to be plotted.

plptex(x,y,dx,dy,just,text);

Writes text at a specified position and inclination within the viewport. Text is clipped at the viewport boundaries. The reference point of a string lies along a line passing through the string at half the height of a capital letter. The position of the reference point along this line is determined by just, the reference point is placed at world coordinates (x,y) within the viewport. The inclination of the string is specified in terms of differences of world coordinates making it easy to write text parallel to a line in a graph.

x (float, input)x coordinate of reference point of string.

y (float, input)y coordinate of reference point of string.

dx (float, input)Together with dy, this specifies the inclination of the string. The baseline of the string is parallel to a line joining (x,y) to (x+dx,y+dy).

dy (float, input)Together with dx, this specifies the inclination of the string.

just (float, input)Specifies the position of the string relative to its reference point. If just=0, the reference point is at the left and if just=1, it is at the right of the string. Other values of just give intermediate justifications.

text (char *, input)The string to be written out.

plschr(def,scale);

This sets up the size of all subsequent characters drawn. The actual height of a character is the product of the default character size and a scaling factor.

def (float, input)The default height of a character in millimetres, should be set to zero if the default height is to remain unchanged.

scale (float, input)Scale factor to be applied to default to get actual character height.

plside3(x,y,z,ly,nx,ny,opt);

Draws sides on three dimensional plots. The sides extend from the plotted function down to the x-y plane. Should only be called after plot3d. The arguments passed to plside3 should be the same as those used in plot3d.

x (float *, input)Pointer to set of x coordinate values at which the function is evaluated.

y (float *, input)Pointer to set of y coordinate values at which the function is evaluated.

z (float *, input)Pointer to two dimensional array with set of function values.

ly (int, input)Declared second dimension of z array.

nx (int, input)Number of x values at which function is evaluated.

ny (int, input)Number of y values at which function is evaluated.

opt (int, input)Determines the way in which the sides are drawn:

plsmaj(def,scale);

This sets up the length of the major ticks. The actual length is the product of the default length and a scaling factor as for character height.

def (float, input)The default length of a major tick in millimetres, should be set to zero if the default length is to remain unchanged.

scale (float, input)Scale factor to be applied to default to get actual tick length.

plsmin(def,scale);

This sets up the length of the minor ticks and the length of the terminals on error bars. The actual length is the product of the default length and a scaling factor as for character height.

def (float, input)The default length of a minor tick in millimetres, should be set to zero if the default length is to remain unchanged.

scale (float, input)Scale factor to be applied to default to get actual tick length.

plssym(def,scale);

This sets up the size of all subsequent symbols drawn by plpoin and plsym. The actual height of a symbol is the product of the default symbol size and a scaling factor as for the character height.

def (float, input)The default height of a symbol in millimetres, should be set to zero if the default height is to remain unchanged.

scale (float, input)Scale factor to be applied to default to get actual symbol height.

plstar(nx,ny);

Initializing the plotting package. The program prompts for the device number of the desired output device. The output device is divided into nx by ny sub-pages, each of which may be used independently. The subroutine pladv is used to advance from one subpage to the next.

nx (int, input)Number of subpages to divide output page in the horizontal direction.

ny (int, input)Number of subpages to divide output page in the vertical direction.

plstyl(nels,mark,space);

This sets up the line style for all lines subsequently drawn. A line consists of segments in which the pen is alternately down and up. The lengths of these segments are passed in the arrays mark and space respectively. The number of mark-space pairs is specified by nels. In order to return the line style to the default continuous line, PLSTYL should be called with nels=0.

nels (int, input)The number of mark and space elements in a line. Thus a simple broken line can be obtained by setting nels=1. A continuous line is specified by setting nels=0.

mark (int *, input) Pointer to array with the lengths of the segments during which the pen is down, measured in micrometres.

space (int *, input) Pointer to array with the lengths of the segments during which the pen is up, measured in micrometres.

plsvpa(xmin,xmax,ymin,ymax);

Alternate routine to plvpor for setting up the viewport. This routine should be used only if the viewport is required to have a definite size in millimetres. The routine plgspa is useful for finding out the size of the current subpage.

xmin (float, input)The distance of the left-hand edge of the viewport from the left-hand edge of the subpage in millimetres.

xmax (float, input)The distance of the right-hand edge of the viewport from the left-hand edge of the subpage in millimetres.

ymin (float, input)The distance of the bottom edge of the viewport from the bottom edge of the subpage in millimetres.

ymax (float, input)The distance of the top edge of the viewport from the top edge of the subpage in millimetres.

plsym(n,x,y,code);

Marks out a set of n points at positions (x[i],y[i]), using the symbol defined by code. The code is interpreted as an index in the Hershey font tables.

n (int, input)Number of points to be marked.

x (float *, input)Pointer to array with set of x coordinate values for the points.

y (float *, input)Pointer to array with set of y coordinate values for the points.

code (int, input)Code number for the symbol to be plotted.

pltext();

Sets an interactive device to text mode, used in conjunction with plgra to allow graphics and text to be interspersed. This is not currently supported on the Amiga. All the labelling is drawn in vector mode.

plvpor(xmin,xmax,ymin,ymax);

Device-independent routine for setting up the viewport. This defines the viewport in terms of normalized subpage coordinates which run from 0.0 to 1.0 (left to right and bottom to top) along each edge of the current subpage. Use the alternate routine plsvpa in order to create a viewport of a definite size.

xmin (float, input)The normalized subpage coordinate of the left-hand edge of the viewport.

xmax (float, input)The normalized subpage coordinate of the right-hand edge of the viewport.

ymin (float, input)The normalized subpage coordinate of the bottom edge of the viewport.

ymax (float, input)The normalized subpage coordinate of the top edge of the viewport.

plvsta();

Sets up a standard viewport, leaving a left-hand margin of seven character heights, and four character heights around the other three sides.

plw3s(basex,basey,height,xmin,xmax,ymin,ymax,zmin,zmax,alt,az);

Sets up a window for a three-dimensional surface plot within the currently defined two-dimensional window. The enclosing box for the surface plot defined by xmin, xmax, ymin, ymax, zmin and zmax in user-coordinate space is mapped into a box of world coordinate size basex by basey by height so that xmin maps to -basex/2, xmax maps to basex/2, ymin maps to -basey/2, ymax maps to basey/2, zmin maps to 0 and zmax maps to height. The resulting world-coordinate box is then viewed by an observer at altitude alt and azimuth az. This routine must be called before plbox3 or plot3d. See Section [*] on page [*] for a more complete description of three-dimensional plotting.

basex (float, input)The x coordinate size of the world-coordinate box.

basey (float, input)The y coordinate size of the world-coordinate box.

height (float, input)The z coordinate size of the world-coordinate box.

xmin (float, input)The minimum user x coordinate value.

xmax (float, input)The maximum user x coordinate value.

ymin (float, input)The minimum user y coordinate value.

ymax (float, input)The maximum user y coordinate value.

zmin (float, input)The minimum user z coordinate value.

zmax (float, input)The maximum user z coordinate value.

alt (float, input)The viewing altitude in degrees above the xy plane.

az (float, input)The viewing azimuth in degrees. When az=0, the observer is looking face onto the zx plane, and as az is increased, the observer moves clockwise around the box when viewed from above the xy plane.

plwind(xmin,xmax,ymin,ymax);

Sets up the world coordinates of the edges of the viewport.

xmin (float, input)The world x coordinate of the left-hand edge of the viewport.

xmax (float, input)The world x coordinate of the right-hand edge of the viewport.

ymin (float, input)The world y coordinate of the bottom edge of the viewport.

ymax (float, input)The world y coordinate of the top edge of the viewport.